package cn.xinfei.xdecision.common.utils.enums.enginex;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 组件类型枚举
 */
@Getter
@AllArgsConstructor
public enum ComponentTypeEnum {

    COMPLEX_RULE_BASE("ruleBase", "complexRuleBase", "ruleService", "复杂规则库"),

    SCRIPT_RULE_BASE("ruleBase", "scriptRuleBase", "ruleService", "脚本规则库"),

    DECISION_TABLES("decisionTable", "decisionTable", "decisionTablesService", "决策表"),

    DECISION_TREE("decisionTree", "decisionTree", "decisionTreeService", "决策树"),

    SCORECARD("scorecard", "scorecard", "scorecardService", "评分卡");

    private final String nodeType;

    private final String type;

    private final String className;

    private final String message;

    public static ComponentTypeEnum adapad(String type) {
        for (ComponentTypeEnum componentTypeEnum : ComponentTypeEnum.values()) {
            if (componentTypeEnum.getType().equals(type)) {
                return componentTypeEnum;
            }
        }
        return null;
    }

    public static ComponentTypeEnum getByNodeType(String nodeType) {
        for (ComponentTypeEnum componentTypeEnum : ComponentTypeEnum.values()) {
            if (componentTypeEnum.getNodeType().equals(nodeType)) {
                return componentTypeEnum;
            }
        }
        return null;
    }
}
